<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Music Store 管理员界面</title>
<link type="text/css" rel="Stylesheet" href="style/admin.css" />
<style type="text/css">
#albumEdit {
	margin: 0 0 0 40px;
	line-height: 2;
}

#albumEdit input.txt, #albumEdit select, #albumEdit textarea.txt {
	width: 200px;
}

.a_bg:hover {
	background-color: #F8E281;
}

table {
	width: 750px;
	background-color: #F5F5F5;
	margin-left: 75px;
}

table td {
	width: 40px;
	text-align: left;
	margin-left: 20px;
}
</style>
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
	function handleFile(){
		var fileName = $("fileName").val();
		var file = $("#file").val();
		fileName = file;
	}
	
</script>
</head>

<body>
	<div id="wrapper">
		<div id="header">
			<div id="header-logo">
				<a href="#"><img src="style/images/logo.png" alt=""></img></a>
			</div>
			<div id="header-nav">
				<h3>后台功能</h3>
				<ul>
					<li><a class="a_bg" href="albumlist">商品管理</a></li>
					<li><a class="a_bg" href="#">用户管理</a></li>
				</ul>
			</div>
		</div>
		<div id="content">
			<div id="content-title">
				<h3>添加商品</h3>
			</div>
			<div id="content-main">
				<form action="albumSave" method="post" enctype="multipart/form-data">
					<table>
						<tr>
							<td>唱片名称：</td>
							<td><input type="text" name="title" value="${album.title}" /></td>
						</tr>
						<tr>
							<td>唱片封面：</td>
							<td><input id="fileName" type="text" name="id"
								value="${filename}" /> <img src="CoverImages/${album.id}.jpg"
								width="180px" /> <br /> <input id="file" type="file"
								name="coverImages" onchange="handleFile()" /></td>
						</tr>
						<tr>
							<td>歌手：</td>
							<td><input type="text" name="artist" value="${album.artist}" />
							</td>
						</tr>
						<tr>
							<td>唱片分类：</td>
							<td><select name="genres.id">
									<c:forEach var="g" items="${genres}">
										<c:if test="${g.id==album.genres.id}">
											<option value="${g.id}" selected="selected">${g.name}</option>
										</c:if>
										<c:if test="${g.id!=album.genres.id}">
											<option value="${g.id}">${g.name}</option>
										</c:if>
									</c:forEach>
							</select></td>
						</tr>
						<tr>
							<td>单价：</td>
							<td><input type="text" name="price" value="${album.price}" />
							</td>
						</tr>
						<tr>
							<td>发行日期：</td>
							<td><input type="text" id="dateReleased" name="dateReleased"
								value='<fmt:formatDate value="${album.dateReleased}"/>' /></td>
						</tr>
						<tr>
							<td>唱片详细信息：</td>
							<td><textarea rows="5" cols="30" name="description"></textarea>
							</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td><input type="submit" value="提交" /></td>
						</tr>
					</table>
				</form>
			</div>
		</div>
		<div id="footer">
			<div id="footer-contactUs">
				<p>Sams Music Store</p>
				<p>Design by Sam Chen, July,2011.</p>
			</div>
		</div>
	</div>
</body>
</html>